package com.stu.dao;


import com.stu.beans.User;
import com.stu.utils.JDBCUtil;

public class UserDao {

    public User login(User user){
        String sql ="select name from t_user where name=? and psd=?";
        return JDBCUtil.queryOne(sql,User.class, user.getName(), user.getPsd());
    }

    public int registerUser(User user){
        String sql ="insert into t_user(name,psd) values(?,?)";
        return JDBCUtil.update(sql,user.getName(),user.getPsd());
    }

    public User queryName(String name){
        String sql ="select name from t_user where name=?";
        return JDBCUtil.queryOne(sql, User.class, name);
    }
}
